﻿@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}
@section head{
    <script type="text/javascript">
        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            treetable: 'treetable-lay/treetable',
            index: 'lib/index'
        }).use(['table', 'form', 'treetable', 'index', 'laydate'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , element = layui.element
                , laydate = layui.laydate
                , treetable = layui.treetable;
            top.SetListPageLanguage(layui);

            // 渲染表格
            orderTable = function () {
                table.render({
                    elem: '#datalist'
                    , url: '/Referral/GetLevelTwoUser'
                    , limit: 20
                    , cols: [[
                        { field: 'ownerFullName', title: '姓名' }
                        , {
                            field: 'CRMAccount', title: 'CRM账号', templet: function (res) {
                                return res.crmAccount
                            }
                        }
                        , { field: 'tradingAccountNo', title: '交易账号' }
                        , { field: 'level', title: '客户等级' }
                        , { field: 'dealCount', title: '交易数量' }
                        , {
                            field: 'time', title: '时间', width: 180, templet: function (res) {
                                if (res.registerTime <= 0) {
                                    return ""
                                }
                                else {
                                    return formatTime(res.registerTime, 'Y-M-D h:m:s')
                                }
                            }
                        }
                    ]]
                    , id: "datalist"
                    , defaultToolbar: false
                    , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                        /**多语言初始化 */
                        top.SetListPageLanguage(layui);
                        //layui.form.render("select");
                    }
                });
            };
            orderTable();
            //查询
            form.on('submit(search)', function (data) {
                //执行重载
                table.reload('datalist', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        order: $("#orderNumber").val(),
                        symbol: $("#symbol option:selected").val(),
                        dealAction: $("#enDealAction  option:selected").val(),
                        entry: $("#enEntryFlags  option:selected").val(),
                        time: $("#timeSetup").val()
                    }
                });
            });

            //重置
            form.on('submit(resetting)', function (data) {
                $("#orderNumber").val(''),
                    $("#symbol").val(''),
                    $("#enDealAction").val(''),
                    $("#enEntryFlags").val(''),
                    $("#timeSetup").val('')
                //执行重载
                table.reload('datalist', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        order: "",
                        symbol: "",
                        dealAction: "",
                        entry: "",
                        time: ""
                    }
                });
            });


        });
    </script>
}
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                @*    <div class="layui-card" lay-filter="component-form-element">
            <div class="layui-card-body layui-form layui-form-pane" style="padding: 15px;">
            <div class="layui-form-item">
            <div class="layui-form-item">
            <div class="layui-inline">
            <label class="layui-form-label" lay-event="timeSetup">时间</label>
            <div class="layui-input-inline">
            <input type="text" class="layui-input" id="timeSetup" name="timeSetup" placeholder="timeSetup" lay-key="8">
            </div>
            </div>
            </div>
            <div class="layui-inline">
            <div class="layui-input-inline">
            <button class="layui-btn" lay-submit lay-filter="search" lay-event="search">搜索</button>
            <button class="layui-btn layui-btn-primary" lay-submit lay-filter="resetting" lay-event="resetting">重置</button>
            </div>
            </div>
            </div>
            </div>
            </div>*@
                <div class="layui-card">
                    <div class="layui-card-body">
                        <div class="layui-tab-content" style="padding:0;">
                            <table class="layui-hide" id="datalist" lay-filter="datalist"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>